package com.gxa.service.baoBiaoService.impl;

import com.gxa.common.R;
import com.gxa.mapper.baobiaomapper.SelectMapper;
import com.gxa.service.baoBiaoService.SelectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SelectServiceImpl implements SelectService {

    @Autowired
    private SelectMapper selectMapper;

    @Override
    public R selectGongYingShang(String gongYingShangInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectGongYingShang(gongYingShangInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("供应商信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectShangPin(String shangPinInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectShangPin(shangPinInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("商品信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectCangKu(String cangKuInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectCangKu(cangKuInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("仓库信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectKeHu(String keHuInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectKeHu(keHuInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("客户信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectZhiYuan(String zhiYuanInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectZhiYuan(zhiYuanInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("职员信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectZhangHu(String zhangHuInfo, String page, String size) {
        R r=new R();
        List list = new ArrayList();
        int statrIndex=(Integer.parseInt(page)-1)*Integer.parseInt(size);
        int endIndex=Integer.parseInt(page)*Integer.parseInt(size);
        list=selectMapper.selectZhangHu(zhangHuInfo, statrIndex ,  endIndex);
        r.setCode(200);
        r.setMsg("账户信息查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectKeHuLeiBie() {
        R r=new R();
        List list = new ArrayList();
        list=selectMapper.selectKeHuLeiBie();
        r.setCode(200);
        r.setMsg("客户类别查询成功！");
        r.setData(list);

        return r;
    }

    @Override
    public R selectGongYingShangLeiBie() {
        R r=new R();
        List list = new ArrayList();
        list=selectMapper.selectGongYingShangLeiBie();
        r.setCode(200);
        r.setMsg("供应商类别查询成功！");
        r.setData(list);

        return r;
    }
}
